﻿using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;

namespace TR0217.ControlEx
{
    [Serializable]
    [TypeConverter(typeof(TriPaddingConverter))]
    public struct TriPadding
    {
        private int _top;
        [DefaultValue(0)]
        public int Top
        {
            get { return _top; }
            set { _top = value; }
        }
        private int _bottom;
        [DefaultValue(0)]
        public int Bottom
        {
            get { return _bottom; }
            set { _bottom = value; }
        }
        private int _side;
        [DefaultValue(0)]
        public int Side
        {
            get { return _side; }
            set { _side = value; }
        }

        [DefaultValue(0)]
        public int All
        {
            get { return _top; }
            set
            {
                _side = value;
                _top = value;
                _bottom = value;
            }
        }

        private int _width;
        [DefaultValue(100)]
        public int Width
        {
            get { return _width; }
            set { _width = value; }
        }

        public TriPadding(int all, int width)
        {
            _top = all;
            _bottom = all;
            _side = all;
            _width = width;
        }

        public TriPadding(int top, int bottom, int side, int width)
        {
            _top = top;
            _bottom = bottom;
            _side = side;
            _width = width;
        }

        public override string ToString()
        {
            return string.Format("({0},{1},{2},{3})", _top, _bottom, _side, _width);
        }
    }
}
